package com.redijedi.tapestry.internal.tree;

import static com.redijedi.tapestry.internal.tree.TreeRendererCommand.CommandState.CLOSE;
import static com.redijedi.tapestry.internal.tree.TreeRendererCommand.CommandState.NONE;
import static com.redijedi.tapestry.internal.tree.TreeRendererCommand.CommandState.OPEN;

/**
 * @author torr
 * 
 */
public enum TreeRendererCommand {

	DO_NOTHING(NONE), OPEN_DIV(OPEN, "div"), OPEN_LIST(OPEN, "ul"), OPEN_ITEM(
			OPEN, "li"), OPEN_SPAN(OPEN, "span"), CLOSE_SPAN(CLOSE), RENDER_BODY, CLOSE_ITEM(
			CLOSE), CLOSE_LIST(CLOSE), CLOSE_DIV(CLOSE);

	public enum CommandState {
		OPEN, CLOSE, NONE;
	}

	private final String elementName;

	private final CommandState state;

	private TreeRendererCommand() {
		this.state = NONE;
		this.elementName = null;
	}

	private TreeRendererCommand(CommandState state) {
		this.state = state;
		this.elementName = null;
	}

	private TreeRendererCommand(CommandState state, String elementName) {
		this.state = state;
		this.elementName = elementName;
	}

	public String getElementName() {
		return elementName;
	}

	public CommandState getState() {
		return state;
	}

}
